package com.ss.android.newmedia.a;

import android.content.DialogInterface;
import java.lang.ref.WeakReference;

public final class WeakDialogListener implements DialogListener {
    private final WeakReference<DialogListener> refDialogListener;

    public WeakDialogListener(DialogListener dialogListener) {
        this.refDialogListener = new WeakReference(dialogListener);
    }

    public final void onCancel(DialogInterface dialog) {
        DialogListener dialogListener = this.refDialogListener.get();
        if(dialogListener != null) {
            dialogListener.onCancel(dialog);
        }
    }

    public final void onDismiss(DialogInterface dialog) {
        DialogListener dialogListener = this.refDialogListener.get();
        if(dialogListener != null) {
            dialogListener.onDismiss(dialog);
        }
    }

    public final void onShow(DialogInterface dialog) {
        DialogListener dialogListener = this.refDialogListener.get();
        if(dialogListener != null) {
            dialogListener.onShow(dialog);
        }
    }
}

